const mongoose = require('mongoose');
mongoose.connect(
    "mongodb://RedBook:lcclcc123@47.97.85.72:27017/RedBook"
  );
const conn = mongoose.connection
conn.on('open',()=>{
    console.log('数据库加载成功');
})
conn.on('error',()=>{
    console.log('数据库加载失败',error);
})
const userSchema = new mongoose.Schema({
    tell:Number,
    password:String,
    name:String,
    avatar:String,
})
const GoodsSchema = new mongoose.Schema({
    title:String,
    price:Number,
    img:String,
    describe:String,
    user:String,
    time:String,
    id:String,
    type:String,
    status:String,
})
const goodsModel = mongoose.model('goodsModel',GoodsSchema)
const userModel = mongoose.model('userModel',userSchema)
module.exports = {userModel, goodsModel}